<!DOCTYPE html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>修饰符简略学习</title>
</head>
<body>
<div id="app">
    <h1>{{message}}</h1>
    <form action="https://www.baidu.com" v-on:submit.prevent="mySubmit">
        <input type="text" v-model="person.name" @enter="mySubmit"><br/><br/>
        <input type="submit" value="提交"><br/><br/>
    </form>
    <p>返回数据为{{count}}</p>
    <button @click.once="mySubmit">单次按钮</button>
    <input type="text" v-model.trim="count">
</div>
<script src="vue.js"></script>
<script>
    let vm = new Vue({
        el: "#app",
        data: {
            message: "修饰符案例",
            person: {},
            count: 0
        },
        methods: {
            mySubmit() {
                if (this.person.name) {
                    console.log(this.person.name);
                    //Ajax...
                    this.count = 66;
                } else {
                    console.log("请输入姓名")
                }
            }
        }
    })
</script>
</body>
</html>